#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
@FileName  :models.py 
@desc      :
@Author    :Young
@IDE       :PyCharm
@Time      :2021/8/31 0031 21:02
'''
from django.db import models

#心理咨询师分类模型
class PsychologicalConsultantCategory(models.Model):
    p_category_id = models.AutoField(primary_key=True)
    p_category_name = models.CharField(max_length=100, blank=True)

    class Meta:
        managed = True
        db_table = 'wyy_psychological_consultantCategory'

#心理咨询师模型
class PsychologicalConsultant(models.Model):
    p_id = models.AutoField(primary_key=True)
    avatar = models.CharField(max_length=200, null=True, blank=True)
    name = models.CharField(max_length=50)
    consulting_count = models.IntegerField() #咨询人次
    working_time = models.IntegerField() #从业时间
    working_place = models.CharField(max_length=100)#服务地点
    qualification = models.CharField(max_length=500)#资质介绍
    fee = models.IntegerField() #咨询收费
    contact_phone = models.CharField() #工作联系方式
    category_id = models.IntegerField() #分类id

    class Meta:
        managed = True
        db_table = 'wyy_psychological_consultant'


class Book_category(models.Model):
    b_category_id = models.AutoField(primary_key=True)
    b_category_name = models.CharField(max_length=100, blank=True)

    class Meta:
        # managed = False
        managed = True
        db_table = 'wyy_book_category'

# 书籍推荐
class Book_recommend(models.Model):#书籍推荐
    book_id = models.AutoField(primary_key=True)
    book_name = models.CharField(max_length=100, blank=True)
    book_author = models.CharField(max_length=100, blank=True)
    author_nation = models.CharField(max_length=100, blank=True)
    book_cover = models.CharField(max_length=300, blank=True)
    book_score = models.FloatField(blank=True,default=0)
    book_category = models.IntegerField(blank=True, null=False)
    book_briefly = models.CharField(max_length=300, blank=True)
    book_publisher = models.CharField(max_length=100, blank=True)
    publish_date = models.DateTimeField(auto_created=True,blank=True)
    class Meta:
        # managed = False
        managed = True
        db_table = 'wyy_book_recommend'

#电影相关
class Movie(models.Model):
    id = models.AutoField(primary_key=True)
    info_link = models.TextField()
    pic_link = models.TextField()
    cname = models.CharField(max_length=200)
    ename = models.CharField(max_length=200)
    rated = models.CharField(max_length=200)
    introduction = models.TextField()
    info = models.TextField()
    score = models.CharField(max_length=200)

    class Meta:
        managed = False
        db_table = 'wyy_movie'


class User(models.Model):  # 抑者&&释抑者
    uid = models.AutoField(primary_key=True)  # 用户id号
    username = models.CharField(max_length=50)  # 用户昵称
    password = models.CharField(max_length=50)  # 用户密码
    avatar = models.CharField(max_length=200, null=True, blank=True)  # 用户头像,头像可以为空
    phone = models.CharField(max_length=11)  # 用户电话号码 不允许为空
    email = models.CharField(max_length=200, blank=True, null=True)  # 用户邮箱
    personality = models.CharField(max_length=200)  # 个性签名
    description = models.CharField(max_length=200)  # 个人介绍
    registration_data = models.DateTimeField(auto_created=True, blank=True)  # 注册时间
    isActive = models.IntegerField(default=0, blank=True)  # 0表示未激活
    isDelete = models.IntegerField(default=0, blank=True)  # 0表示未删除
    role = models.CharField(max_length=10)  # '001' 表示释抑者， '002'表示抑者, 不允许为空

    # 该用户的创作、加入的讨论组、关注的sy, 收藏的文章，历史浏览记录

    class Meta:
        managed = False
        # managed = True
        db_table = 'wyy_user'

# 心愿
class Wish(models.Model):
    wish_id = models.AutoField(primary_key=True)
    wish_content = models.CharField(max_length=500)
    uid = models.IntegerField()
    class Meta:
        managed = True
        db_table = 'wyy_wishes'



# 意见反馈
class Feedback(models.Model):
    opinion_id = models.AutoField(primary_key=True)
    opinion_content = models.TextField(max_length=1000, blank=True, null=False)
    publish_date = models.DateTimeField(auto_created=True, blank=True)

    class Meta:
        managed = True
        db_table = 'wyy_feedback'
# 家庭烦恼
class FamilyTroubles(models.Model):
    id = models.AutoField(primary_key=True)
    uid = models.IntegerField()
    content = models.TextField(max_length=3000)
    publish_date = models.DateTimeField(auto_created=True, blank=True)
    class Meta:
        managed = True
        db_table = 'wyy_family_troubles'


#家庭烦恼的解答
class FamilyTroublesResponse(models.Model):
    id = models.AutoField(primary_key=True)
    uid = models.IntegerField()
    family_troubles_id = models.IntegerField()
    content = models.TextField(max_length=3000)
    publish_date = models.DateTimeField(auto_created=True, blank=True)
    up_count = models.IntegerField(default=0)

    class Meta:
        managed = True
        db_table = 'wyy_family_troubles_response'



# 感情纠结
class EmotionsTroubles(models.Model):
    id = models.AutoField(primary_key=True)
    uid = models.IntegerField()
    content = models.TextField(max_length=3000)
    publish_date = models.DateTimeField(auto_created=True, blank=True)

    class Meta:
        managed = True
        db_table = 'wyy_emotion_troubles'


#感情纠结类回复
class EmotionsTroublesResponse(models.Model):
    id = models.AutoField(primary_key=True)
    uid = models.IntegerField()
    emotion_trouble_id = models.IntegerField()
    content = models.TextField(max_length=3000)
    publish_date = models.DateTimeField(auto_created=True, blank=True)
    up_count = models.IntegerField(default=0)
    class Meta:
        managed = True
        db_table = 'wyy_emotion_troubles_response'

# 学习压力
class StudyPressure(models.Model):
    id = models.AutoField(primary_key=True)
    uid = models.IntegerField()
    content = models.TextField(max_length=3000)
    publish_date = models.DateTimeField(auto_created=True, blank=True)

    class Meta:
        managed = True
        db_table = 'wyy_study_pressure'

# 学习压力类经验回复
class StudyPressureResponse(models.Model):
    id = models.AutoField(primary_key=True)
    uid = models.IntegerField()
    study_pressure_id = models.IntegerField()
    content = models.TextField(max_length=3000)
    publish_date = models.DateTimeField(auto_created=True, blank=True)
    up_count = models.IntegerField(default=0)

    class Meta:
        managed = True
        db_table = 'wyy_study_pressure_response'

# 工作压力分享
class WorkPressure(models.Model):
    id = models.AutoField(primary_key=True)
    uid = models.IntegerField()
    content = models.TextField(max_length=3000)
    publish_date = models.DateTimeField(auto_created=True, blank=True)

    class Meta:
        managed = True
        db_table = 'wyy_work_pressure'


# 学习压力类经验回复
class WorkPressureResponse(models.Model):
    id = models.AutoField(primary_key=True)
    uid = models.IntegerField()
    work_pressure_id = models.IntegerField()
    content = models.TextField(max_length=3000)
    publish_date = models.DateTimeField(auto_created=True, blank=True)
    up_count = models.IntegerField(default=0)

    class Meta:
        managed = True
        db_table = 'wyy_work_pressure_response'

# 解忧杂货铺
# 一些文章，今日推荐阅读
class JieYou(models.Model):
    jieyou_id = models.AutoField(primary_key=True)
    jieyou_content = models.TextField(max_length=3000)
    publish_date = models.DateTimeField(auto_created=True, blank=True)
    uid = models.IntegerField()
    up_count = models.IntegerField()

    class Meta:
        managed = True
        db_table = 'wyy_jieyou'
